import http from 'http.js'

//code换取用户信息
export function userLogin (obj) {
  return http('/shop/user/wechat/login', obj)
}

//首页数据
export function queryIndexData (obj) {
  return http('/shop/wechat/index', obj)
}

//店铺商品
export function queryShopData (businessId) {
  return http(`/shop/wechat/querybusinessdetail/${businessId}`, {},"GET")
}

//根据商家id查询购物车详情
export function queryCartDetail (businessId) {
  return http(`/shop/order/querycart/${businessId}`, {},"GET")
}

//新增/删除购物车(小程序端)
export function addCart (type,obj) {
  return http(`/shop/order/addcart/${type}`, obj, "PUT")
}

//确认订单(小程序端)
export function affirmOrder (businessId) {
  return http(`/shop/order/affirmOrder/${businessId}`, {},"GET")
}

//创建订单(小程序端)
export function addorder (obj) {
  return http(`/shop/order/addorder`,obj)
}
//统一下单入口
export function topay (orderId) {
  return http(`/shop/wxpay/topay/${orderId}`,{},"GET")
}

//查询收件人列表
export function queryAddrList (obj) {
  return http(`/shop/receiver/selectPage`,obj)
}
//新增收件人
export function addreceiver (obj) {
  return http(`/shop/receiver/web/addreceiver`,obj)
}
//根据id批量删除收件人
export function deletereceiver (obj) {
  return http(`/shop/receiver/web/deletereceiver`,obj)
}

//根据id修改收件人
export function updatereceiver (obj) {
  return http(`/shop/receiver/web/updatereceiver`,obj, "PUT")
}

//查询订单列表
export function getOrderList (obj) {
  return http(`/shop/wechat/orderPage`,obj)
}

//申请退款接口
export function refund (orderId) {
  return http(`/shop/wxpay/refund/${orderId}`,{},"GET")
}